package cn.edu.cuc.yjsy.model;

import java.util.Map;

import org.eclipse.emf.ecore.EPackage;
import cn.edu.cuc.yjsy.model.impl.ModelPackageImpl;

public class ModelManager {
	/**
	 * Contains the factory associated with the model.
	 */
	private static ModelFactory modelFactory = null;
	
	static{
		// Initialize the model package
		ModelPackageImpl.init();
	}
	
	public static ModelFactory getFactory() {
		if (modelFactory == null) {
			// Access the factory (needed to create instances)
			Map registry = EPackage.Registry.INSTANCE;
			String databaseURI = ModelPackage.eNS_URI;
			ModelPackage modelPackage =
				(ModelPackage) registry.get(databaseURI);
			modelFactory = modelPackage.getModelFactory();
		}
		return modelFactory;
	}
}
